﻿using System;
using System.Collections;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

namespace IntraVision.Web
{
    public class ViewData : Hashtable
    {
        protected List<Exception> _Exceptions;
        public List<Exception> Exceptions { get { return _Exceptions; } set { _Exceptions = value; } }
        

        public ViewData()
        {
            _Exceptions = new List<Exception>();

        }

        public string GetSetting(string key)
        {
            return Settings.GetFromDatabase(key);
        }

        public string GetConfig(string key)
        {
            return Settings.GetFromWebConfig(key);
        }

        public override object this[object key]
        {
            get
            {
                if (!base.ContainsKey(key.ToString())) throw new KeyNotFoundException(String.Format(CultureInfo.InvariantCulture, "The given key \"{0}\" was not present in the dictionary.", key.ToString()));
                return base[key.ToString()];
            }
            set
            {
                base[key.ToString()] = value;
            }
        }
    }
}
